package com.boot.start.controller;

import com.boot.start.config.log.SystemLog;
import com.boot.start.config.result.ResultResponse;
import com.boot.start.config.result.StatusCode;
import com.boot.start.entity.Employee;
import com.boot.start.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 墨龙吟
 * @version 1.0.0
 * @ClassName EmployeeController.java
 * @Email 2354713722@qq.com
 * @Description Employee 控制器
 * @createTime 2020年05月19日 - 21:32
 */
@RestController
@RequestMapping("/employee")
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    /**
     * 获取所有员工信息
     * @param request
     * @return
     */
    @GetMapping("/hello")
    @SystemLog(description = "hello")
    public ResultResponse<List<Employee>> hello(HttpServletRequest request) {
        List<Employee> res = employeeService.getEmployeeList();
        return ResultResponse.ok.build(StatusCode.SUCCESS, res);
    }

}
